package com.company.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.base.common.persistence.Page;
import com.company.model.CompanyProject;
import com.company.model.ProjectWorkHours;
import com.company.service.ProjectWorkHoursService;

@Controller
public class ProjectWHController {
	public static final String toWorkHourView = "/company/project/workhour";
	public static final String projectWHList = "/company/project/workhour/list";
	
	
	// 页面路径
	public static final String projectPage = "/company/projectWH";
	
	@Autowired
	ProjectWorkHoursService projectWorkHoursService;
	
	
	@RequestMapping(value = toWorkHourView, method = RequestMethod.POST)
	public ModelAndView toWorkHourView() {
		ModelAndView mv = new ModelAndView(projectPage);
		return mv;
	}
	
	@ResponseBody
	@RequestMapping(value = projectWHList, method = RequestMethod.POST)
	public Page projectList(HttpServletRequest req, HttpServletResponse res, Page page, String projectId) {
		try {
			page = projectWorkHoursService.findProjectWHPageByProjectId(projectId, page);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return page;
	}
}
